#pragma once

#ifndef DBCONNECTIONH_H_
#define DBCONNECTIONH_H_

#include "DBDatabase.h"
#include "DBObject.h"

namespace SQLDoc
{
	class DBDatabase;

	class DBConnection : public DBObject
	{
	public:
		DBConnection(void);
		virtual ~DBConnection(void);

		virtual QString connectionName(void) const;
		virtual void setConnectionName(QString val);

		virtual int selectDatabases(bool refresh = false);
		virtual int databaseCount(void);

		virtual void setActiveDatabase(DBDatabase* active);

		virtual void rewriteDatabases(void);
		virtual void fillDatabases() = 0 { m_isValid = true; };

	protected:
		QString m_connectionName;
		QList<DBDatabase*> m_databases;
		bool m_isValid;
		DBDatabase* m_activeDatabase;
	};
}

#endif